// AuthWrapper.jsx

import React, { useEffect } from 'react';
import { history } from 'umi';

export default function AuthWrapper(props) {
  useEffect(() => {
    const username = JSON.parse(localStorage.getItem('username'));
    if (!username) {
      history.push('/login'); // 如果用户未登录，则跳转到登录页面
    }
  }, [history]);

  return <>{props.children}</>;
}
